import { SurroundModelInfo } from "./info/SurroundModelInfo";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
//class SurroundModelConfig
    
    export  class SurroundModelConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (SurroundModelConfig._instance != null) 
            {
                throw new Error(" SurroundModelConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            if (typeof arg1.model === "array") 
            {
                loc2 = arg1.model;
            }
            else 
            {
                loc2 = [arg1.model];
            }
            var loc4=0;
            var loc5=loc2;
            for(loc3 of loc5) 
            {
                loc1 = new SurroundModelInfo();
                loc1.name = loc3.name;
                if (loc3.hasOwnProperty("sceneY")) 
                {
                    loc1.sceneY = loc3.sceneY;
                }
                if (loc3.hasOwnProperty("isTop")) 
                {
                    loc1.isTop = loc3.isTop;
                }
                this._map[loc1.name] = loc1;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("surroundModel.xml");
            this.write(loc1);
            return;
        }

        public getModelInfoByName(arg1: string): SurroundModelInfo
        {
            return this._map[arg1];
        }

        public static get instance(): SurroundModelConfig
        {
            if (SurroundModelConfig._instance == null) 
            {
                SurroundModelConfig._instance = new SurroundModelConfig();
            }
            return SurroundModelConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: SurroundModelConfig;
    }
